#
cmd_route_table = {}


# def cmd_dispatch(para):
#     def wrapper1(fun):
#             cmd_route_table[para] = fun
#             return fun
#     return wrapper1


def cmd_dispatch(para):
    def wrapper1(fun):
        #写到这里的话 @cmd_dispatch('查询价格')写这句话的时候就会执行
        cmd_route_table[para] = fun
        def wrapper2():
            # 这个写到这里的话，要调用fun函数才会执行
            # cmd_route_table[para] = fun   
            fun()
        return wrapper2
    return wrapper1


class cmd_dispatch1:
    def __init__(self):
        self.func_dispatch = {}
    
    def zhuce(self,yewu_name):
        def decorator(func):
            self.func_dispatch[yewu_name]=func
            return func
        return decorator